<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <title>商倍益-管理登陆</title>
    <link rel="stylesheet" href="__CSS__/admin/member/login.css">
    <script src="__JS__/common/jquery.min.js"></script>
</head>
<body>
<div class="main">
    <div class="box">
        <form action="/Member/login" method="post" id="login_form">
            <input type="text" id="tel" name="tel">
            <input type="text" id="safecode" name="safecode">
            <button id="sendsafecode" onclick="send();return false;">发送</button>
            <button id="login_btn" onclick="login()"></button>
            <button id="reg_btn" onclick="reg();return false;"></button>
        </form>
    </div>
</div>
<script>
    var msg='{$msg}'
    if(msg!="")
    {
        alert(msg)
    }
    var issend = false
    time = 60
    $(function () {
        init()
    })
    function init() {

    }
    function send() {
        if (issend)return false;

        $.post("/member/sendsafecode", {tel: $("#tel").val(), type: "login"}, function (data) {
            if (data.error_code == 0) {
                issend = true
                timeout()
            } else {
                alert(data.reason)
            }
        })
    }
    function login() {
        $("#login_form").submit()
    }
    function reg() {
        alert("暂未开放申请")
    }
    function timeout() {
        if (time > 0) {
            time -= 1
            $("#sendsafecode").html(time)
            setTimeout("timeout()", 1000)
        } else {
            issend = false
            time = 60
            $("#sendsafecode").html("发送")
        }
    }
</script>
</body>
</html>